module Singly
  class Auth
    class Service
      attr_reader :service
      attr_reader :is_oauth1

      def initialize(service, is_oauth1=false)
        @service = service
        @is_oauth1 = is_oauth1
      end

      def apply(params={})
        params ||= {}
        apply_type = is_oauth1 ? Singly::Auth::Service::Oauth1Apply : Singly::Auth::Service::Oauth2Apply
        apply_type.new(params.merge({
          service: service.to_s,
          client_id: Singly.client_id, 
          client_secret: Singly.client_secret
        }))
      end
    end
  end
end